package cn.regentsoft;

import com.bstek.ureport.export.ExportConfigure;
import com.bstek.ureport.export.ExportManager;
import com.bstek.ureport.export.html.HtmlReport;
import org.apache.commons.lang3.StringUtils;

import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Map;

public class Test implements ExportManager {
    @Override
    public HtmlReport exportHtml(String s, String s1, Map<String, Object> map) {
        return null;
    }

    @Override
    public HtmlReport exportHtml(String s, String s1, Map<String, Object> map, int i) {
        return null;
    }

    @Override
    public void exportPdf(ExportConfigure exportConfigure) {

    }

    @Override
    public void exportExcel(ExportConfigure exportConfigure) {

    }

    @Override
    public void exportExcel97(ExportConfigure exportConfigure) {

    }

    @Override
    public void exportExcelWithPaging(ExportConfigure exportConfigure) {

    }

    @Override
    public void exportExcel97WithPaging(ExportConfigure exportConfigure) {

    }

    @Override
    public void exportExcelWithPagingSheet(ExportConfigure exportConfigure) {

    }

    @Override
    public void exportExcel97WithPagingSheet(ExportConfigure exportConfigure) {

    }

    @Override
    public void exportWord(ExportConfigure exportConfigure) {
        String sql = null;
        sql = "SELECT pn.id AS nodeId," +
                "                pn.name AS nodeName," +
                "                fmpn.id AS missionNodeId," +
                "                su.id AS chargerId," +
                "                su.user_name AS chargerName," +
                "                fm.id AS missionId," +
                "                fm.order_no AS orderNo," +
                "                gu.style_no AS styleNo," +
                "                fmpn.labour_cost AS labourCost," +
                "                fmpnrq.id AS qId," +
                "                IFNULL(fmpnrq.quantity, 0) AS qs," +
                "                fmpnrd.id AS dId," +
                "                fmpnrd.id IS NOT NULL AS ds," +
                "                fmpnrw.id AS wId," +
                "                fmpnrw.id IS NOT NULL AS ws," +
                "                fmpn.status AS status," +
                "                fmpn.date_end AS dateEnd," +
                "                fm.actual_cutting_completed && (" +
                "                IFNULL(fmpn.doac, FALSE) || IFNULL(" +
                "                fmpn.is_associate_wym," +
                "                        FALSE" +
                "                      )" +
                "                    ) AS actualCutting," +
                "                    IFNULL(" +
                "                      (" +
                "                         SELECT" +
                "                          sum(fmd.num)" +
                "                        FROM" +
                "                          factory_mission_detail AS fmd" +
                "                        WHERE" +
                "                          fmd.mission_id = fm.id" +
                "                      )," +
                "                      0" +
                "                          sum(fmpstq.quantity)" +
                "                        FROM" +
                "                          fac_mission_prcd_sku_target_quantity AS fmpstq" +
                "                        WHERE" +
                "                          fmpstq.fac_mission_id = fm.id" +
                "                      )," +
                "                      0" +
                "                    ) AS total," +
                "                    IFNULL(" +
                "                      (" +
                "                        SELECT" +
                "                    ) AS acTotal" +
                "                  FROM" +
                "                    fac_mission_prcd_node AS fmpn" +
                "                  INNER JOIN prcd_node AS pn ON fmpn.prcd_node_id = pn.id" +
                "                  AND pn.time_deleted = 0" +
                "                  INNER JOIN fac_mission_prcd_node_report AS fmpnr ON fmpn.id = fmpnr.fac_mission_prcd_node_id" +
                "                  AND fmpnr.time_deleted = 0" +
                "                  LEFT JOIN fac_mission_prcd_node_report_qualified AS fmpnrq ON fmpnr.id = fmpnrq.fac_mission_prcd_node_report_id" +
                "                  LEFT JOIN fac_mission_prcd_node_report_defectived AS fmpnrd ON fmpnr.id = fmpnrd.fac_mission_prcd_node_report_id" +
                "                  AND fmpnrd.status IN (0, 2)" +
                "                  AND fmpnrd.time_deleted = 0" +
                "                  LEFT JOIN fac_mission_prcd_node_report_wasted AS fmpnrw ON fmpnr.id = fmpnrw.fac_mission_prcd_node_report_id" +
                "                  INNER JOIN sys_user AS su ON fmpnr.charger_id = su.id" +
                "                  INNER JOIN factory_mission AS fm ON fmpn.fac_mission_id = fm.id" +
                "                  INNER JOIN goods_unit AS gu ON fm.goods_id = gu.id" +
                "                  WHERE" +
                "                    pn.unit_id = :unitId" +
                "                  AND su.id IN (:staffIds)";
                
        
        
        
        String sql2="SELECT pn.id AS nodeId," +
                "pn.name AS nodeName," +
                "fmpn.id AS missionNodeId," +
                "su.id AS chargerId," +
                "su.user_name AS chargerName," +
                "fm.id AS missionId," +
                "fm.order_no AS orderNo," +
                "gu.style_no AS styleNo," +
                "fmpn.labour_cost AS labourCost," +
                "                            fmpnrq.id AS qId," +
                "                            IFNULL(fmpnrq.quantity, fmpnr.total) AS qs," +
                "                            fmpnrd.id AS dId," +
                "                            fmpnrd.id IS NOT NULL AS ds," +
                "                            fmpnrw.id AS wId," +
                "                            fmpnrw.id IS NOT NULL AS ws," +
                "                            fmpn.status AS status," +
                "                            fmpn.date_end AS dateEnd," +
                "                            IFNULL(" +
                "                              (" +
                "                                SELECT" +
                "                                  sum(report.total)" +
                "                                FROM" +
                "                                  fac_mission_prcd_node_report AS report" +
                "                                WHERE" +
                "                                  report.fac_mission_prcd_node_id = fmpn.id" +
                "                                AND report.time_deleted = 0" +
                "                              )," +
                "                              0" +
                "                            ) AS completed," +
                "                            fm.actual_cutting_completed && (" +
                "                              IFNULL(fmpn.doac, FALSE) || IFNULL(" +
                "                                fmpn.is_associate_wym," +
                "                                FALSE" +
                "                              )" +
                "                            ) AS actualCutting," +
                "                           IFNULL(" +
                "                              (" +
                "                                SELECT" +
                "                                  sum(fmd.num)" +
                "                                FROM" +
                "                                  factory_mission_detail AS fmd" +
                "                                WHERE" +
                "                                  fmd.mission_id = fm.id" +
                "                              )," +
                "                             0" +
                "                            ) AS total," +
                "                            IFNULL(" +
                "                              (" +
                "                                SELECT" +
                "                                  sum(fmpstq.quantity)" +
                "                               FROM" +
                "                                  fac_mission_prcd_sku_target_quantity AS fmpstq" +
                "                                WHERE" +
                "                                  fmpstq.fac_mission_id = fm.id" +
                "                              )," +
                "                              0" +
                "                            ) AS acTotal" +
                "                          FROM" +
                "                            prcd_node AS pn" +
                "                          INNER JOIN prcd_node_type AS pnt ON pn.prcd_node_type_id = pnt.id" +
                "                          INNER JOIN fac_mission_prcd_node AS fmpn ON pn.id = fmpn.prcd_node_id" +
                "                          AND fmpn.time_deleted = 0" +
                "                          INNER JOIN factory_mission AS fm ON fmpn.fac_mission_id = fm.id" +
                "                          INNER JOIN goods_unit AS gu ON fm.goods_id = gu.id" +
                "                          INNER JOIN fac_mission_prcd_node_report AS fmpnr ON fmpn.id = fmpnr.fac_mission_prcd_node_id" +
                "                          AND fmpnr.time_deleted = 0" +
                "                          INNER JOIN sys_user AS su ON fmpnr.charger_id = su.id" +
                "                          LEFT JOIN fac_mission_prcd_node_report_qualified AS fmpnrq ON fmpnr.id = fmpnrq.fac_mission_prcd_node_report_id" +
                "                          LEFT JOIN fac_mission_prcd_node_report_defectived AS fmpnrd ON fmpnr.id = fmpnrd.fac_mission_prcd_node_report_id" +
                "                          AND fmpnrd.status IN (0, 2)" +
                "                          AND fmpnrd.time_deleted = 0" +
                "                          LEFT JOIN fac_mission_prcd_node_report_wasted AS fmpnrw ON fmpnr.id = fmpnrw.fac_mission_prcd_node_report_id";







    }
}